/*
 * @Author: 谢小康 2170673706@qq.com
 * @Date: 2024-01-13 14:43:22
 * @LastEditors: 谢小康 2170673706@qq.com
 * @LastEditTime: 2024-02-02 23:20:27
 * @FilePath: \My-bolg\server\model\friends.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const { DataTypes } = require('sequelize');
const sq = require('./db.js')
const moment = require('moment')
const Friends = sq.define('friend', {
    friend_name: {
        type: DataTypes.STRING,
        allowNull: false,
        require:true,
        comment: "友链名字",
    },
    friend_url: {
        type: DataTypes.STRING,
        allowNull: false,
        require:true,
        comment: "友链地址",
    },
    friend_note:{
        type: DataTypes.STRING,
        comment: "友链备注",
    },
    friend_corver:{
        type: DataTypes.STRING,
        allowNull: false,
        require:true,
        comment: "友链头像",

    },
    friend_sign:{
        type: DataTypes.STRING,
        allowNull: false,
        require:true,
        comment: "友链签名",

    },
    friend_status:{
        type: DataTypes.INTEGER,
        allowNull: false,
        require:true,
        comment: "1:表示友链通过 2:表示还没有核实",
        defaultValue: 2,
    },
    createdAt: {
        type: DataTypes.DATE,
        get() {
            return moment(this.getDataValue("createdAt")).format("YYYY-MM-DD HH:mm:ss")
        },
    },
    updatedAt: {
        type: DataTypes.DATE,
        get() {
            return moment(this.getDataValue("updatedAt")).format("YYYY-MM-DD HH:mm:ss")
        },
    },
}, {
    // 这是其他模型参数
    freezeTableName: true,
});

module.exports = Friends;